package cn.pping.exception;

import lombok.Data;

/**
 * @Description: 自定义全局异常类
 * @Author: Pan
 * @Version: 1.0
 * @Date: 2022/8/26 10:23
 */
@Data
public class GlobalException extends RuntimeException {
    private String errorMessage;
    private String errorCode;

    /*
     * @Description: 自定义异常无参构造
     * @Author: Director
     * @Date: 2022/8/7 15:42
     * @return:
     **/
    public GlobalException() {
        super();
    }

    /*
     * @Description: 自定义异常有参构造
     * @Author: Director
     * @Date: 2022/8/7 15:48
     * @param errorCode: 异常码
     * @param errorMessage: 异常信息
     * @return: null
     **/
    public GlobalException(String errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public GlobalException(GlobalEnumCode globalEnumCode) {
        super(globalEnumCode.getMessage());
        this.errorCode = globalEnumCode.getCode();
        this.errorMessage = globalEnumCode.getMessage();
    }

}
